package classpath

import "io/ioutil"
import "path/filepath"

type DirEntry struct {
	absDir string //表示目录的绝对路径
}

//给DirEntry结构定义了一个方法
func (self *DirEntry) readClass(className string) ([]byte, Entry, error) {
	filename := filepath.Join(self.absDir, className)
	data, err := ioutil.ReadFile(filename)
	return data, self, err
}

func (self *DirEntry) String() string {
	return self.absDir
}
func newDirEntry(path string) *DirEntry {
	dir, err := filepath.Abs(path)
	if err != nil {
		panic(err) //panic函数终止程序执行
	}
	return &DirEntry{dir}
}
